<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
	<th:block th:include="include :: header('新增运输类型')" />
</head>
<body class="white-bg">
	<div class="wrapper wrapper-content animated fadeInRight ibox-content">
		<form class="form-horizontal m" id="form-transport-add">
			<div class="form-group">
				<label class="col-sm-3 control-label is-required">运输单位类型：</label>
				<div class="col-sm-8">
					<input class="form-control" type="text" name="transportUnitTypeId" id="transportUnitTypeId" required>
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label is-required">重量能力：</label>
				<div class="col-sm-8">
					<input class="form-control" type="text" name="weightCapacity" id="weightCapacity" required>
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label is-required">重量计量单位：</label>
				<div class="col-sm-8">
					<input class="form-control" type="text" name="uomForWeight" id="weight" required>
					<a class="btn btn-primary btn-rounded btn-sm" onclick="showOpen('Weight')"><i class="fa fa-search"></i>&nbsp;请选择</a>
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label is-required">体积容量：</label>
				<div class="col-sm-8">
					<input class="form-control" type="text" name="volumeCapacity" id="volumeCapacity" required>
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label is-required">体积计量单位：</label>
				<div class="col-sm-8">
					<input class="form-control" type="text" name="uomForVolume" id="volume" required>
					<a class="btn btn-primary btn-rounded btn-sm" onclick="showOpen('Volume')"><i class="fa fa-search"></i>&nbsp;请选择</a>
				</div>
			</div>
<!--			<div class="form-group">-->
<!--				<label class="col-sm-3 control-label">岗位状态：</label>-->
<!--				<div class="col-sm-8">-->
<!--				    <div class="radio-box" th:each="dict : ${@dict.getType('sys_normal_disable')}">-->
<!--						<input type="radio" th:id="${dict.dictCode}" name="status" th:value="${dict.dictValue}" th:checked="${dict.default}">-->
<!--						<label th:for="${dict.dictCode}" th:text="${dict.dictLabel}"></label>-->
<!--					</div>-->
<!--				</div>-->
<!--			</div>-->
			<div class="form-group">
				<label class="col-sm-3 control-label is-required">描述：</label>
				<div class="col-sm-8">
					<input class="form-control" type="text" name="description" id="description" required>
				</div>
			</div>
		</form>
	</div>
	<th:block th:include="include :: footer" />
	<script type="text/javascript">
		var prefix = ctx + "transport";
		function showOpen(value) {
			var prefixTable = ctx + "demo/modal";
			$.modal.open("选择用户", prefixTable + "/radionForisounit?unitType="+value);
		}

		$("#form-transport-add").validate({
			onkeyup: false,
			rules:{
				transportUnitTypeId:{
					remote: {
		                url: ctx + "system/post/checkPostNameUnique",
		                type: "post",
		                dataType: "json",
		                data: {
		                	"transportUnitTypeId" : function() {
		                        return $.common.trim($("#transportUnitTypeId").val());
		                    }
		                },
		                dataFilter: function(data, type) {
		                	return $.validate.unique(data);
		                }
		            }
				},
				weightCapacity:{
					digits:true
				},
				volumeCapacity:{
					digits:true
				},
			},
			messages: {
		        "transportUnitTypeId": {
		            remote: "运输类型已经存在"
		        }
		    },
		    focusCleanup: true
		});
		
		function submitHandler() {
	        if ($.validate.form()) {
	        	$.operate.save(prefix + "/add", $('#form-transport-add').serialize());
	        }
	    }
	</script>
</body>
</html>
